<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - thread_pool_extension_abstract.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2008  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#undef</font> DLIB_THREAD_POOl_ABSTRACT_H__
<font color='#0000FF'>#ifdef</font> DLIB_THREAD_POOl_ABSTRACT_H__ 

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='threads_kernel_abstract.h.html'>threads_kernel_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../uintn.h.html'>../uintn.h</a>"

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>class</font> <b><a name='future'></a>future</b>
    <b>{</b>
        <font color='#009900'>/*!
            INITIAL VALUE 
                - is_ready() == true

            WHAT THIS OBJECT REPRESENTS
                This object represents a container that allows you to safely pass objects 
                into the tasks performed by the thread_pool object defined below.  An
                example will make it clear:

                    // Suppose you have a global function defined as follows
                    void add (int a, int b, int&amp; result) { result = a + b; }

                    // Also suppose you have a thread_pool named tp defined somewhere.
                    // Then you could do the following.
                    future&lt;int&gt; a, b, result;
                    a = 3;
                    b = 4;
                    // this function call causes another thread to execute a call to the add() function
                    // and passes in the int objects contained in a, b, and result
                    tp.add_task(add,a,b,result);
                    // This line will wait for the task in the thread pool to finish and then print the
                    // value in the result integer.  So it will print a 7.
                    cout &lt;&lt; result &lt;&lt; endl;
        !*/</font>

    <font color='#0000FF'>public</font>:
        <b><a name='future'></a>future</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - The object of type T contained in this future has
                  an initial value for its type. 
                - #is_ready() == true
        !*/</font>

        <b><a name='future'></a>future</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - #get() == item
                - #is_ready() == true
        !*/</font>

        <b><a name='future'></a>future</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> future<font color='#5555FF'>&amp;</font> item
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            ensures
                - if (item.is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to the item future has finished.
                - #is_ready() == true
                - #item.is_ready() == true
                - #get() == item.get()
        !*/</font>

        ~<b><a name='future'></a>future</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
        !*/</font>

        <font color='#0000FF'><u>bool</u></font> <b><a name='is_ready'></a>is_ready</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - if (the value of this future may not yet be ready to be accessed because it 
                  is in use by a task in a thread_pool) then
                    - returns false 
                - else
                    - returns true 
        !*/</font>

        future<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
                - #is_ready() == true
                - #get() == item
                - returns *this
        !*/</font>

        future<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> future<font color='#5555FF'>&amp;</font> item
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false || item.is_ready() == false) then
                    - the call to this function blocks until the threads processing the tasks related
                      to this future and the item future have finished.
                - #is_ready() == true
                - #item.is_ready() == true
                - #get() == item.get()
                - returns *this
        !*/</font>

        <b><a name='operator'></a>operator</b> T<font color='#5555FF'>&amp;</font> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
                - #is_ready() == true
                - returns get()
        !*/</font>

        <b><a name='operator'></a>operator</b> <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
                - #is_ready() == true
                - returns get()
        !*/</font>

        T<font color='#5555FF'>&amp;</font> <b><a name='get'></a>get</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
                - #is_ready() == true
                - returns a non-const reference to the object of type T contained inside this future
        !*/</font>

        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> <b><a name='get'></a>get</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - if (is_ready() == false) then
                    - the call to this function blocks until the thread processing the task related
                      to this future has finished.
                - #is_ready() == true
                - returns a const reference to the object of type T contained inside this future
        !*/</font>

    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>inline</font> <font color='#0000FF'><u>void</u></font> <b><a name='swap'></a>swap</b> <font face='Lucida Console'>(</font>
        future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a,
        future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b
    <font face='Lucida Console'>)</font> <b>{</b> std::<font color='#BB00BB'>swap</font><font face='Lucida Console'>(</font>a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#009900'>/*!
        provides a global swap function
    !*/</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>

<font color='#009900'>//  The future object comes with overloads for all the usual comparison operators.
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font>  b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font>  b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>=</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>!</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>&gt;</font><font color='#5555FF'>=</font> b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font>  b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&lt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>&lt;</font>  b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font>         <b>{</b> <font color='#0000FF'>return</font> a.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font>  b; <b>}</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> <font color='#0000FF'><u>bool</u></font> <b><a name='operator'></a>operator</b><font color='#5555FF'>&gt;</font>  <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> a,         <font color='#0000FF'>const</font> future<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> a       <font color='#5555FF'>&gt;</font>  b.<font color='#BB00BB'>get</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='thread_pool'></a>thread_pool</b> 
    <b>{</b>
        <font color='#009900'>/*!
            WHAT THIS OBJECT REPRESENTS
                This object represents a fixed size group of threads which you can
                submit tasks to and then wait for those tasks to be completed. 

                Note that setting the number of threads to 0 is a valid way to
                use this object.  It causes it to not contain any threads
                at all.  When tasks are submitted to the object in this mode
                the tasks are processed within the calling thread.  So in this
                mode any thread that calls add_task() is considered to be
                a thread_pool thread capable of executing tasks.

                This object is also implemented such that no memory allocations occur 
                after the thread_pool has been constructed so long as the user doesn't 
                call any of the add_task_by_value() routines.  The future object also 
                doesn't perform any memory allocations or contain any system resources 
                such as mutex objects. 

            EXCEPTIONS
                Note that if an exception is thrown inside a task thread and 
                is not caught then the normal rule for uncaught exceptions in
                threads applies. That is, the application will be terminated.
        !*/</font>

    <font color='#0000FF'>public</font>:
        <font color='#0000FF'>explicit</font> <b><a name='thread_pool'></a>thread_pool</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num_threads
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - #num_threads_in_pool() == num_threads
            throws
                - std::bad_alloc
                - dlib::thread_error
                    the constructor may throw this exception if there is a problem 
                    gathering resources to create threading objects.
        !*/</font>

        ~<b><a name='thread_pool'></a>thread_pool</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            ensures
                - blocks until all tasks in the pool have finished.
        !*/</font>

        <font color='#0000FF'><u>bool</u></font> <b><a name='is_task_thread'></a>is_task_thread</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - if (the thread calling this function is one of the threads in this
                  thread pool or num_threads_in_pool() == 0) then
                    - returns true
                - else
                    - returns false
        !*/</font>

        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='num_threads_in_pool'></a>num_threads_in_pool</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - returns the number of threads contained in this thread pool.  That is, returns
                  the maximum number of tasks that this object will process concurrently.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> F<font color='#5555FF'>&amp;</font> function_object
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - function_object() is a valid expression 
            ensures
                - makes a copy of function_object, call it FCOPY.
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls FCOPY() within the calling thread and returns when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls FCOPY().
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - obj will not go out of scope until after the task has completed (i.e. 
                  this function passes obj to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (obj.*funct)() within the calling thread and returns
                      when it finishes.
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (obj.*funct)()
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> 
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
            ensures
                - makes a copy of obj, call it OBJ_COPY.
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (OBJ_COPY.*funct)() within the calling thread and returns 
                      when it finishes.
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (OBJ_COPY.*funct)().
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font>,
            <font color='#0000FF'><u>long</u></font> arg1
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - obj will not go out of scope until after the task has completed (i.e. 
                  this function passes obj to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (obj.*funct)(arg1) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (obj.*funct)(arg1)
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font>,<font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font>,
            <font color='#0000FF'><u>long</u></font> arg1,
            <font color='#0000FF'><u>long</u></font> arg2
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - obj will not go out of scope until after the task has completed (i.e. 
                  this function passes obj to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (obj.*funct)(arg1,arg2) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (obj.*funct)(arg1,arg2)
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'><u>void</u></font> <b><a name='wait_for_task'></a>wait_for_task</b> <font face='Lucida Console'>(</font>
            uint64 task_id
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - if (there is currently a task with the given id being executed in the thread pool) then
                    - the call to this function blocks until the task with the given id is complete
                - else
                    - the call to this function returns immediately
        !*/</font>

        <font color='#0000FF'><u>void</u></font> <b><a name='wait_for_all_tasks'></a>wait_for_all_tasks</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>;
        <font color='#009900'>/*!
            ensures
                - the call to this function blocks until all tasks which were submitted
                  to the thread pool by the thread that is calling this function have 
                  finished.
        !*/</font>

        <font color='#009900'>// --------------------
</font>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - function_object(arg1.get()) is a valid expression 
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function object)
                - function_object will not go out of scope until after the task has completed (i.e. 
                  this function passes function_object to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls function_object(arg1.get()) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls function_object(arg1.get()).
                - #arg1.is_ready() == false 
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>;
        <font color='#009900'>/*!
            requires
                - function_object(arg1.get()) is a valid expression 
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function object)
            ensures
                - makes a copy of function_object, call it FCOPY.
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls FCOPY(arg1.get()) within the calling thread and returns when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls FCOPY(arg1.get()).
                - #arg1.is_ready() == false 
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - (obj.*funct)(arg1.get()) must be a valid expression.
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function)
                - obj will not go out of scope until after the task has completed (i.e. 
                  this function passes obj to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (obj.*funct)(arg1.get()) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (obj.*funct)(arg1.get()).
                - #arg1.is_ready() == false 
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - (obj.*funct)(arg1.get()) must be a valid expression.
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function)
            ensures
                - makes a copy of obj, call it OBJ_COPY.
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (OBJ_COPY.*funct)(arg1.get()) within the calling thread and returns 
                      when it finishes.
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (OBJ_COPY.*funct)(arg1.get()).
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - (obj.*funct)(arg1.get()) must be a valid expression.
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function)
                - obj will not go out of scope until after the task has completed (i.e. 
                  this function passes obj to the task by reference.  If you want to avoid
                  this restriction then use add_task_by_value())
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (obj.*funct)(arg1.get()) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (obj.*funct)(arg1.get()).
                - #arg1.is_ready() == false 
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid member function pointer for class T
                - (obj.*funct)(arg1.get()) must be a valid expression.
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function)
            ensures
                - makes a copy of obj, call it OBJ_COPY.
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls (OBJ_COPY.*funct)(arg1.get()) within the calling thread and returns 
                      when it finishes.
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls (OBJ_COPY.*funct)(arg1.get()).
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1
        <font face='Lucida Console'>)</font>; 
        <font color='#009900'>/*!
            requires
                - funct == a valid function pointer 
                - (funct)(arg1.get()) must be a valid expression.
                  (i.e. The A1 type stored in the future must be a type that can be passed into the given function)
            ensures
                - if (is_task_thread() == true and there aren't any free threads available) then
                    - calls funct(arg1.get()) within the calling thread and returns
                      when it finishes
                - else
                    - the call to this function blocks until there is a free thread in the pool
                      to process this new task.  Once a free thread is available the task
                      is handed off to that thread which then calls funct(arg1.get()).
                - #arg1.is_ready() == false 
                - returns a task id that can be used by this-&gt;wait_for_task() to wait
                  for the submitted task to finish.
        !*/</font>

        <font color='#009900'>// --------------------------------------------------------------------------------
</font>        <font color='#009900'>// The remainder of this class just contains overloads for add_task() and add_task_by_value() 
</font>        <font color='#009900'>// that take up to 4 futures (as well as 0 futures).  Their behavior is identical to the above 
</font>        <font color='#009900'>// add_task() and add_task_by_value() functions.
</font>        <font color='#009900'>// --------------------------------------------------------------------------------
</font>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>; 
        
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                  <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2
        <font face='Lucida Console'>)</font>; 

        <font color='#009900'>// --------------------
</font>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                  <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                  <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3
        <font face='Lucida Console'>)</font>; 

        <font color='#009900'>// --------------------
</font>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2, <font color='#0000FF'>typename</font> A3, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font> A1, <font color='#0000FF'>typename</font> A2, <font color='#0000FF'>typename</font> A3, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> F<font color='#5555FF'>&amp;</font> function_object,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3,
                              <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3,T4<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3,
                              <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3,T4<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3,
                              <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3,T4<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>; 

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                              <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                              <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3,
                              <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3,T4<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> A1,
                  <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> A2,
                  <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> A3,
                  <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> A4<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>T1,T2,T3,T4<font face='Lucida Console'>)</font>,
            future<font color='#5555FF'>&lt;</font>A1<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg1,
            future<font color='#5555FF'>&lt;</font>A2<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg2,
            future<font color='#5555FF'>&lt;</font>A3<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg3,
            future<font color='#5555FF'>&lt;</font>A4<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> arg4
        <font face='Lucida Console'>)</font>;

        <font color='#009900'>// --------------------
</font>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            F<font color='#5555FF'>&amp;</font> function_object
        <font face='Lucida Console'>)</font>;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>,
        <font face='Lucida Console'>)</font>; 
        
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
        uint64 <b><a name='add_task_by_value'></a>add_task_by_value</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> obj,
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font>T::<font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <font face='Lucida Console'>)</font>; 

        uint64 <b><a name='add_task'></a>add_task</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>void</u></font> <font face='Lucida Console'>(</font><font color='#5555FF'>*</font>funct<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
        <font face='Lucida Console'>)</font>; 

        <font color='#009900'>// --------------------
</font>
    <font color='#0000FF'>private</font>:

        <font color='#009900'>// restricted functions
</font>        <b><a name='thread_pool'></a>thread_pool</b><font face='Lucida Console'>(</font>thread_pool<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>;        <font color='#009900'>// copy constructor
</font>        thread_pool<font color='#5555FF'>&amp;</font> <b><a name='operator'></a>operator</b><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>thread_pool<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font>;    <font color='#009900'>// assignment operator
</font>    <b>}</b>;

<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_THREAD_POOl_ABSTRACT_H__
</font>



</pre></body></html>